package Demo_Old.Demo;

public class ThreadDemo implements Runnable {


    @Override
    public void run() {
        for(int i = 0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+"--------------"+i);
        }
    }

    public static void main(String[] args) {

        ThreadDemo runnableDemo = new ThreadDemo();
        Thread thread = new Thread(runnableDemo);
        ThreadDemo runnableDemo2 = new ThreadDemo();
        Thread thread2 = new Thread(runnableDemo2);
        thread.start();

        thread2.start();
        for(int i =0;i<5;i++){
            System.out.println(Thread.currentThread().getName()+"==========="+i);
        }

//        int priority = Thread.currentThread().getPriority();
//        System.out.println(Thread.currentThread().getName()+priority);
//        Runnable runnable=new ThreadDemo();
//        Thread thread1=new Thread(runnable);
//        Thread thread2=new Thread(runnable);
//        Thread thread3=new Thread(runnable);
//        Thread thread4=new Thread(runnable);
//        Thread thread5=new Thread(runnable);
       // System.out.println(thread2.getPriority());
//        thread1.start();
//        thread2.start();
//        thread3.start();
//        thread4.start();
//        thread5.start();
       // Thread.currentThread().setPriority(1);


//        for (int i = 0; i < 8; i++) {
//            System.out.println(Thread.currentThread().getName()+"==>"+i);
////            if (i==5){
////                try {
////                    thread1.join();
////                } catch (InterruptedException e) {
////                    e.printStackTrace();
////                }
////            }
//        }
    }

}
